<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@taglib prefix="c" uri ="http://java.sun.com/jsp/jstl/core"%>
<%--使用taglib 引入标签库--%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>DASHMIN - Bootstrap Admin Template</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <link href="css/css2.css" rel="stylesheet">
    <link href="css/all.min.css" rel="stylesheet">
    <link href="css/bootstrap-icons.css" rel="stylesheet">
    <link href="css/owl.carousel.min.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/messageBox.css" rel="stylesheet">

    <script>
        window.onload = function() {
            var errorMessage = "${errorMessage}";
            var successMessage = "${successMessage}";
            var messageBox = document.getElementById('messageBox');

            if (errorMessage) {
                messageBox.textContent = errorMessage;
                messageBox.style.display = 'block';
                setTimeout(function() {
                    messageBox.style.display = 'none';
                }, 2000);
            } else if (successMessage) {
                messageBox.textContent = successMessage;
                messageBox.style.display = 'block';
                setTimeout(function() {
                    messageBox.style.display = 'none';
                }, 2000);
            }
        };
    </script>
    <style>
    </style>
</head>
<body>
<div class="container-fluid position-relative bg-white d-flex p-0">


    <div class="sidebar pe-4 pb-3">
        <nav class="navbar bg-light navbar-light">
            <a href="admin?action=list" class="navbar-brand mx-4 mb-3">
                <h3 class="text-primary">网上请假系统</h3>
            </a>

            <div class="navbar-nav w-100">
                <a href="admin?action=adminList" class="nav-item nav-link">个人设置</a>
                <a href="admin?action=list" class="nav-item nav-link ">二级学院管理</a>
                <a href="instructor?action=list" class="nav-item nav-link active">辅导员信息管理</a>
            </div>
        </nav>
    </div>


    <div class="content">
        <nav class="navbar navbar-expand bg-light navbar-light px-4 py-0" style="height: 48px;">
            <form action="instructor" method="get">
                <div class="d-none d-md-flex ms-4">
                    <input style="margin-top: 18px;width: 630px;background-color: #f0f0f0;" class="form-control border-0" type="text" id="instID" placeholder="请输入关键字" name="keyword">
                    <button type="submit" class="btn btn-outline-primary" style="width: 80px;margin-top: 17px !important;margin-left: 5px;">查询</button>
                    <input type="hidden" name="action" value="seek">
                </div>
            </form>
            <div class="d-flex align-items-center justify-content-between mb-4">
                <form action="instructor" method="get">
                    <button type="submit" class="btn btn-outline-primary" style="width: 99px;margin-top: 40px !important;margin-left: 10px;">查看全部</button>
                    <input type="hidden" name="action" value="list">
                </form>
                <%--                <a href="classes?action=list"><h6 class="mb-0">查看全部</h6></a>--%>
                <button type="button" class="btn btn-outline-success" data-toggle="modal" data-target="#staticBackdrop" style="width: 176px;margin-left: 10px;margin-top: 40px;">添加辅导员信息</button>
                <form action="instructor?action=add" id="addClassForm" method="post">
                    <div class="modal fade" id="staticBackdrop" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title" id="staticBackdropLabel">添加辅导员信息</h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true">&times;</span>
                                    </button>
                                </div>
                                <div class="modal-body" style="text-align: left;">
                                    <div class="form-group">
                                        <label for="instID">工号：</label>
                                        <input type="text" class="form-control" placeholder="instID" name="instID" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="instName">姓名：</label>
                                        <input type="text" class="form-control" placeholder="instName" name="instName" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="depID">二级学院编号：</label>
                                        <input type="text" class="form-control" placeholder="depID" name="depID" required>
                                    </div>
                                    <div class="form-group">
                                        <label for="telephone">联系电话：</label>
                                        <input type="text" class="form-control" placeholder="telephone" name="telephone" required>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                                    <button type="submit" class="btn btn-primary">确定</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="navbar-nav align-items-center ms-auto" style="">
                <div class="nav-item dropdown">
                    <a href="login.jsp" class="btn btn-outline-danger" style="margin-top: 17px; width: 65px; margin-left: 8px; display: inline-block;">退出</a>
                    <input type="hidden" name="action" value=".../login.jsp">
                </div>
            </div>
        </nav>
        <div class="shadow-sm p-3 mb-5 bg-white rounded">
            <div class="container-fluid pt-4 px-4" style="background-color: #efefef;">
                <div class="bg-light text-center rounded p-4" style="height: 630px !important;>

                <form>
                    <div class="table-responsive">
                <table class="table text-start align-middle table-bordered table-hover mb-0">
                    <thead>
                    <tr class="text-dark">
                        <th scope="col"><input  type="checkbox"></th>
                        <th scope="col">工号</th>
                        <th scope="col">姓名</th>
                        <th scope="col">学院</th>
                        <th scope="col">联系电话</th>
                        <th scope="col">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${list}" var="list">
                        <tr>
                            <td><input  type="checkbox"></td>
                            <td>${list.instID}</td>
                            <td>${list.instName}</td>
                            <td>${list.depID}</td>
                            <td>${list.telephone}</td>
                            <td >
                                <a class="btn btn-outline-primary btn-sm" data-toggle="modal" data-target="#exampleModalCenter-${list.instID}">修改</a>
                                <form action="instructor" method="post" style="display: contents">
                                    <div class="modal fade" id="exampleModalCenter-${list.instID}" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-hidden="true" >
                                        <div class="modal-dialog modal-dialog-centered">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h5 class="modal-title" id="exampleModalCenterTitle">修改辅导员信息- ${list.instID}</h5>
                                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span>
                                                    </button>
                                                </div>

                                                <div class="modal-body">
                                                    <p>
                                                        <input type="hidden" name="instID" value="${list.instID}">
                                                            <%--                                                                <input type="hidden" name="depID" value="${classes_list.depID}">--%>
                                                    <div class="form-group">
                                                        <label for="depID-${list.instName}">班号：</label>
                                                        <input type="text" class="form-control" placeholder="instName" name="instName" value="${list.instName}" required>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="depName-${list.depID}">班级名称：</label>
                                                        <input type="text" class="form-control" placeholder="depID" name="depID" value="${list.depID}" required>
                                                    </div>
                                                    <div class="form-group">
                                                        <label for="depName-${list.telephone}">班级名称：</label>
                                                        <input type="text" class="form-control" placeholder="telephone" name="telephone" value="${list.telephone}" required>
                                                    </div>

                                                    </p>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                                                    <button type="submit" class="btn btn-primary">确定</button>
                                                    <input type="hidden" name="action" value="edit">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                                <a  class="btn btn-outline-primary btn-sm" href="instructor?action=delete&instID=${list.instID}"
                                   onclick="return confirm('您确定删除该辅导员信息')">删除</a>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            </form>
        </div>
    </div>
</div>
</div>
</div>
<div id="messageBox"></div>

<script src="js/jquery-3.4.1.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/bootstrap.bundle.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/chart.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/easing.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/waypoints.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/owl.carousel.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/moment.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/moment-timezone.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/tempusdominus-bootstrap-4.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>

<script src="js/main.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
<script src="js/rocket-loader.min.js" data-cf-settings="4bebc94b2db97a1f9680a39f-|49" defer=""></script>
</body>
</html>